<?php
/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */


if (!defined('RAIZ')) define('RAIZ', $_SERVER['DOCUMENT_ROOT']. '/neumo/'); 

require_once RAIZ . "liblnk/lib/PHPMailer_5.2.0/class.phpmailer.php";
require_once RAIZ . "liblnk/lib/PHPMailer_5.2.0/class.smtp.php";
require_once RAIZ . 'db/db_mysql.php';

function email_envia($correodestino, $nombre,$asunto,$cuerpo) {
  //@entregar: cambiar los datos del smtp del correo
  $db_general= new dbase_general();
  $val= $db_general->toma_datos();
  $db_general->cierra();
  
  $mail = new PHPMailer();
  $mail->IsSMTP();
  $mail->SMTPDebug = 1;
  $mail->CharSet = 'utf-8'; 
  $mail->SMTPKeepAlive = true;  
  $mail->Mailer = "smtp";
  $mail->SMTPAuth = true;
  $mail->SMTPSecure = "ssl";
  $mail->Host = $val['servidor']; // "smtp.gmail.com";
  $mail->Port = 465;
  $mail->Username = $val['usuario'];//"Desarrollo.DS@Gmail.com";
  $mail->Password = $val['password'];//"tacoronte";

  $mail->From = $val['correo'];//"Desarrollo.DS@Gmail.com";
  $mail->FromName = $val['desde'];//"neumo.canarias";
  $mail->Subject = $asunto;
  $mail->AltBody = $cuerpo;
  $mail->MsgHTML($cuerpo);
  $mail->AddAddress($correodestino, $nombre);
  $mail->IsHTML(TRUE);
  //$mail->AddAttachment("files/files.zip");
  //$mail->AddAttachment("files/img03.jpg");
  
  
  $valor= $mail->Send();
  return $valor;
}

?>
